<!DOCTYPE html>
<html lang="en">
<head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
    </head>
    <body>
        
    </body>
    <script>
        // 要过滤的敏感词
        var arr=["1","3","5","7","9"]
        // 可能要过滤的字符
        var str="0,1,2,3,4,5,6,7,8,9"
        // 遍历要过滤的字符
        for(i=0;i<str.length;i++){
            // console.log(arr[i])
            // 遍历敏感词，拿到每个敏感词
            arr.forEach(function(val){
                // 替换敏感词，并手动赋值给原字符
                str=str.replace(val,"*");
            })
        }
        console.log(str)


        // 练习
        
        // var arr=["妈","操","黄","皮","滚"];
        // var str="游戏玩的菜的一皮，你妈买皮，给老子滚,滚...";


        // for(i=0;i<str.length;i++){
        //     // console.log(arr[i])

        //     arr.forEach(function(val){
        //         str=str.replace(val,"*");
        //     })
        // }
        // console.log(str)




    </script>
</html>